Skip to content

Conversation

@doringeman
Copy link
Contributor

@doringeman doringeman commented Oct 22, 2025

Reverts docker/model-cli#126.

Summary by Sourcery

Remove the deprecated --backend flag and related backend parameters across CLI commands and client methods, simplifying API calls to use a unified endpoint and updating documentation accordingly.

Enhancements:

  • Remove backend parameter from run and list command signatures and logic
  • Simplify desktop.Client Chat and HTTP helper methods by eliminating backend and apiKey arguments
  • Unify chat completions endpoint to /v1/chat/completions without backend segments
  • Remove DefaultBackend constant and backend validation code

Documentation:

  • Remove hidden backend option from run and list CLI reference documentation

Copilot AI review requested due to automatic review settings October 22, 2025 10:32
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 22, 2025

Reviewer's Guide

This PR removes the unused --backend flag and associated API key logic by reverting previous backend-related changes across the CLI commands, interactive functions, chat helpers, desktop client methods, and documentation.

Entity relationship diagram for CLI command options after backend flag removal

erDiagram
  CLI_COMMANDS {
    string name
    string[] options
  }
  OPTION {
    string name
    string value_type
    string default_value
    string description
  }
  CLI_COMMANDS ||--o{ OPTION : has
Loading

Class diagram for updated desktop.Client methods after backend flag removal

classDiagram
class Client {
  +List()
  +ListOpenAI()
  +Chat(model, prompt string, imageURLs []string, outputFunc func(string), shouldUseMarkdown bool) error
  +ChatWithContext(ctx context.Context, model, prompt string, imageURLs []string, outputFunc func(string), shouldUseMarkdown bool) error
  -doRequest(method, path string, body io.Reader) (*http.Response, error)
  -doRequestWithAuth(method, path string, body io.Reader) (*http.Response, error)
  -doRequestWithAuthContext(ctx context.Context, method, path string, body io.Reader) (*http.Response, error)
}
Loading

Class diagram for updated CLI command functions after backend flag removal

classDiagram
class run_go {
  +generateInteractiveWithReadline(cmd, desktopClient, model string) error
  +generateInteractiveBasic(cmd, desktopClient, model string) error
  +chatWithMarkdown(cmd, desktopClient, model, prompt string) error
  +chatWithMarkdownContext(ctx, cmd, desktopClient, model, prompt string) error
}
class list_go {
  +newListCmd() *cobra.Command
  +listModels(openai bool, desktopClient *desktop.Client, quiet bool, jsonFormat bool, modelFilter string) (string, error)
}
Loading

File-Level Changes

Change Details Files
Remove backend flag and API key handling from run and list commands
  • Deleted backend variable and flag definitions
  • Removed backend validation and API key retrieval
  • Updated calls to model inspection, chat, and interactive modes to drop backend/apiKey arguments
cmd/cli/commands/run.go
cmd/cli/commands/list.go
Simplify interactive modes by dropping backend and API key parameters
  • Updated signatures of generateInteractiveWithReadline and generateInteractiveBasic
  • Adjusted fallback and chat calls to remove backend/apiKey
cmd/cli/commands/run.go
Streamline chat helpers to accept only model and prompt
  • Removed backend and apiKey parameters from chatWithMarkdown and chatWithMarkdownContext
  • Simplified client.ChatWithContext invocations
cmd/cli/commands/run.go
Refactor desktop client to remove backend and API key arguments
  • Updated Chat and ChatWithContext signatures to drop backend/apiKey
  • Simplified doRequestWithAuth and doRequestWithAuthContext
  • Modified ListOpenAI to use listRaw without backend or API key
cmd/cli/desktop/desktop.go
Remove backend option from reference documentation
  • Deleted backend entries in docker_model_list.yaml
  • Deleted backend entries in docker_model_run.yaml
cmd/cli/docs/reference/docker_model_list.yaml
cmd/cli/docs/reference/docker_model_run.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the unused backend flag and related functionality from the CLI commands. The changes revert a previous addition that allowed specifying different backends (llama.cpp, openai, vllm) for model operations.

Key changes:

  • Removed the backend command-line flag from run and list commands
  • Eliminated backend validation and OpenAI API key handling logic
  • Simplified client methods by removing backend and API key parameters

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cmd/cli/docs/reference/docker_model_run.yaml Removed backend option from run command documentation
cmd/cli/docs/reference/docker_model_list.yaml Removed backend option from list command documentation
cmd/cli/desktop/desktop.go Simplified client methods by removing backend/apiKey parameters and related logic
cmd/cli/commands/run.go Removed backend flag, validation, and parameter passing from run command
cmd/cli/commands/list.go Removed backend flag, validation, and parameter passing from list command
cmd/cli/commands/backend.go Deleted entire file containing backend validation utilities

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @doringeman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on cleaning up the command-line interface by removing the --backend flag and all related functionality. This change simplifies the user experience and reduces code complexity by eliminating a feature that is no longer in use, as indicated by the revert of a previous PR. The modifications span across command definitions, internal client API calls, and documentation.

Highlights

  • Backend Flag Removal: The --backend flag and all its associated logic, including validation and API key handling, have been completely removed from the CLI commands.
  • Code Cleanup: The cmd/cli/commands/backend.go file, which contained backend validation functions and API key retrieval, has been deleted. This simplifies the codebase by removing unused components.
  • API Simplification: Internal client methods in cmd/cli/desktop/desktop.go such as ListOpenAI and Chat have been refactored to no longer accept backend or apiKey parameters, streamlining their interfaces.
  • Documentation Update: The documentation for the docker model list and docker model run commands has been updated to reflect the removal of the --backend flag.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request reverts a previous change, removing the --backend flag and its associated logic from the CLI commands and client methods. The changes are well-contained and correctly remove the functionality from run and list commands, their documentation, and the underlying client API calls. The code is cleaner and simpler as a result. I have one minor suggestion to remove a stale comment that is no longer relevant after these changes.

@doringeman doringeman force-pushed the clean-unused-backend-flag branch from 7cb754e to 695c2b8 Compare October 22, 2025 10:38
@ericcurtin ericcurtin merged commit c183f67 into docker:main Oct 22, 2025
6 checks passed
@ericcurtin
Copy link
Contributor

Should have checked with @ilopezluna to be sure here... Mea cupla clicking merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants